﻿// -----------------------------------------------------------------------
// <copyright file="BasicGun.cs" company="Diddly Squad">
// </copyright>
// -----------------------------------------------------------------------
using Microsoft.Xna.Framework;
using System.Collections.Generic;

namespace DiddlySquat
{
	/// <summary>
	/// Class for creating simplest gun
	/// </summary>
	public class BasicGun : Weapon
	{

		/// <summary>
		/// Initializes a new instance of the <see cref="BasicGun"/> class.
		/// </summary>
		public BasicGun()
		{
			this.SpriteFileName = Constants.BasicGunSprite;
			this.Speed = Constants.BasicGunBulletSpeed;
		}

		/// <summary>
		/// Fires the specified projectiles and plays sound.
		/// </summary>
		/// <param name="projectiles">The projectiles.</param>
		/// <param name="soundLevel">The sound level.</param>
		public override void Fire(List<Projectile> projectiles, int soundLevel)
		{
			var projectile = new Projectile();

			projectiles.Add(projectile);

			projectile.Initialize(this.World, this.Body.Position + new
			  Vector2(0f, 0f), 10f, this.Direction, ProjectileSprite);

			projectile.Launch();
			this.ShootingSound.Play(0.1f * soundLevel, 1f, 0f);
		}
	}
}
